package com.daedalus.klasaObjekte.data;
import java.util.Calendar;
/*
 * Created with IntelliJ IDEA.
 * Author: Kostika Gorica
 * Date: 12-11-06
 * Time: 10.55.MD
 */



public class Data {

    Calendar calendar = Calendar.getInstance();

    public Data(int viti, int muaji, int dita) {
        calendar.set(viti,muaji,dita);
    }

    public void shtoDite(int nrDite){
        calendar.add(Calendar.DATE,nrDite);
    }

    public void shtoJave(int nrJave){
        calendar.add(Calendar.DATE,nrJave*7);
    }

    public int getViti() {
        return calendar.get(Calendar.YEAR);
    }

    public int getMuaji() {
        return calendar.get(Calendar.MONTH);
    }

    public int getDita() {
        return calendar.get(Calendar.DATE);
    }

    public int nrDite (Data dataTjeter){
        long m1=calendar.getTimeInMillis();
        System.out.println(m1);
        long m2= dataTjeter.calendar.getTimeInMillis();
        System.out.println(m2);
        System.out.println(m2-m1);
        return (int) ((m2-m1)/(24*3600000));
    }

    public String toString(){
        return String.format("%d/%d/%d",getDita(),getMuaji(),getViti());
    }
}